package com.groupname.dangerousdelves;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.app.Activity;

// -------------------------------------------------------------------------
/**
 * This class displays the splash screen for a few seconds then creates a new
 * thread for the game logic and starts the main menu in it.
 *
 * @author Chris Fieldman (Chrisf90)
 * @version 2012.11.15
 */
public class SplashActivity
    extends Activity
{
    // ~-------------------------------------------------------------------------
    // Methods
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.splashscreen);

        new Handler().postDelayed(new Thread() {
            @Override
            public void run()
            {
                DangerousDelvesGame.context = getApplicationContext();
                DangerousDelvesGame.fileIO =
                    new AndroidFileIO(DangerousDelvesGame.context);

                Intent mainMenu =
                    new Intent(SplashActivity.this, MainMenuScreen.class);

                SplashActivity.this.startActivity(mainMenu);
                SplashActivity.this.finish();
                overridePendingTransition(R.layout.fadein, R.layout.fadeout);
            }
        }, 4000);
    }

}
